package com.dayuanit.dy17.mix.proxy.dynamicproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 另外一种代理逻辑
 */
public class ServiceBeginInvocationHandler implements InvocationHandler {
    private Object target;

    public ServiceBeginInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        //proxy before
        System.out.println("----- server begin... ------");

        //执行目标方法
        Object result = null;
//        result= method.invoke(target, args);

        //proxy after
        System.out.println("----- sever over -----");

        return result;
    }
}
